package com.fufufu.mail.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;

import com.fufufu.common.annotation.ListValue;
import com.fufufu.common.valid.AddGroup;
import com.fufufu.common.valid.UpdateGroup;
import com.fufufu.common.valid.UpdateStatusGroup;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 品牌
 * 
 * @author zyx
 * @email 1262074394@qq.com
 * @date 2022-09-15 08:15:48
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	// 修改的时候品牌id不能为空,接口只是给标识，因为后面其他模块也可能存在新增和修改的不同情况，所以就放在common里面了
	@NotNull(message = "修改时id不能为空", groups = {UpdateGroup.class})
	// 新增的时候品牌id必须为空
	@Null(message = "新增不能指定id", groups = {AddGroup.class})
	@TableId
	private Long brandId;
	/**
	 * 品牌名
	 */
	// 无论是新增还是修改，品牌名都不能为空
	@NotBlank(message = "品牌名不能为空", groups = {AddGroup.class, UpdateGroup.class})

	private String name;
	/**
	 * 品牌logo地址
	 */
	@URL(message = "地址非法", groups = {AddGroup.class, UpdateGroup.class})
	@NotBlank(message = "logo不能为空", groups = {AddGroup.class})
	private String logo;
	/**
	 * 介绍
	 */
	private String descript;
	/**
	 * 显示状态[0-不显示；1-显示]
	 */
	@NotNull(message = "显示状态不能为空", groups = {AddGroup.class, UpdateStatusGroup.class})
	@ListValue(vals = {0, 1}, message = "非法值", groups = {AddGroup.class, UpdateStatusGroup.class, UpdateGroup.class})
	private Integer showStatus;
	/**
	 * 检索首字母
	 */
	// 修改的时候可以不携带
	@NotBlank(groups = {AddGroup.class})
	@Pattern(regexp = "^[a-zA-z]$", groups = {AddGroup.class, UpdateGroup.class})
	private String firstLetter;
	/**
	 * 排序
	 */
	@NotNull(groups = {AddGroup.class})
	@Min(value = 0, groups = {AddGroup.class, UpdateGroup.class})
	private Integer sort;

}
